package com.bestcem.xm.ticket.controller.param.ticket.config.createParam;

import com.bestcem.xm.ticket.constant.ColumnConstant;
import com.bestcem.xm.ticket.entity.mongo.Ticket;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.annotation.Nullable;
import java.io.Serializable;

/**
 * @author zq.ding <zq.ding@idiaoyan.com>
 * @version v1.0
 * @date 2021/9/8 16:56
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class TemplateDetailFieldParam implements Serializable {
    private static final long serialVersionUID = 2808726620840986656L;

    /**
     * content
     */
    @JsonProperty(value = ColumnConstant.Ticket.TemplateDetailField.CONTENT)
    private String content;

    /**
     * sourceId
     */
    @JsonProperty(value = ColumnConstant.Ticket.TemplateDetailField.SOURCE_ID)
    private String sourceId;

    /**
     * originText
     */
    @JsonProperty(value = ColumnConstant.Ticket.TemplateDetailField.ORIGIN_TEXT)
    private String originText;

//        @JsonProperty(value = "value")
//        private Ticket.TemplateDetailField.SurveyAnswer value;

    @Nullable
    public static Ticket.TemplateDetailField paramToEntity(TemplateDetailFieldParam param) {
        if (param == null) {
            return null;
        }
        Ticket.TemplateDetailField templateDetailField = new Ticket.TemplateDetailField();
        templateDetailField.setContent(param.getContent());
        templateDetailField.setSourceId(param.getSourceId());
        templateDetailField.setOriginText(param.getOriginText());
//        templateDetailField.setValue(SurveyAnswerParam.paramToEntity(param));
//        templateDetailField.setValue(ValueParam.paramToEntity(param));
        return templateDetailField;

    }
}
